<template>
	<div>
		<div class="user-card mt10">
			<p class="text-title">快速数据统计设置</p>
			<el-divider border-style="dashed" />
			<ul class="nav-menu">
				<li class="nav-item" v-for="(data, k) in changeData" :key="k">
					<div>
						<ul class="flex align-center">
							<li class="flex align-center mr8 f16" v-for="(item, index) in data" :key="index">
								<p class="mr8">{{ item.ruleLabel }}</p>
									<el-input-number
										v-model="item.value"
										:precision="0"
										:step="1"
										controls-position="right"
										style="width: 200px"
										@change="handleChange(item, 1)"
									/>
									<span class="padding">{{item.rule==7?'次':'天内'}}</span>
							</li>
						</ul>
					</div>
				</li>
			</ul>
		</div>
	</div>
</template>

<script setup lang="ts">
import apiMod from '@/apiMod/index'

const changeData = ref({}) as any

const talbeName = {
	dp_foundation_practitioners_material: '从业人员',
	dp_service_object_material: '服务对象',
	dp_service_org_material: '养老机构',

	dp_service_object: '服务对象',
	dp_service_org_base: '养老机构',
	dp_foundation_practitioners: '从业人员',
}
const getCategoy1 = () => {
	apiMod
		.view_dpConfig_map({
			category: 3,
			subCategory:4,
		})
		.then((res) => {
			const data = res.data
			changeData.value = data
		})
}

const getInitData = () => {
	getCategoy1()
}
const handleChange = (item, type) => {
	apiMod
		.view_dpConfig_edit({
			id: item.id,
			value: item.value,
		})
		.then(() => {
			ElMessage.success('更新成功')
				getCategoy1()
		})
}
onMounted(() => {
	getInitData()
})
</script>

<style scoped lang="scss">
.user-card {
	background: #fff;
	padding: 10px;
	border-radius: 4px;
	.text-title {
		padding-top: 15px;
		color: #000;
		font-weight: 600;
		font-size: 16px;
	}
}
.nav-menu {
	.nav-item {
		padding: 10px;
		border-bottom: 1px solid #eee;
		&-label {
			color: #000;
			font-weight: 700;
			padding-bottom: 10px;
		}
	}
}
</style>
